package com.BigDecimal;

import java.util.Scanner;

public class BigDecimalDemo3 {
    public static void main(String[] args) {
        //创建Scanner对象
        Scanner sc = new Scanner(System.in);

        //接收用户输入
        System.out.println("请输入姓名：");
        String name = sc.nextLine();

        System.out.println("请输入年龄：");
        String ageStr = sc.nextLine();

        System.out.println("请输入身高：");
        String heightStr = sc.nextLine();

        System.out.println("请输入婚否："); //必须输入 true 或 false
        String flagStr = sc.nextLine();

        System.out.println("请输入性别：");
        String genderStr = sc.nextLine();

        //转换
        int age = Integer.parseInt(ageStr);
        double height = Double.parseDouble(heightStr);
        boolean flag = Boolean.parseBoolean(flagStr);
        char gender = genderStr.charAt(0);

        student s = new student("王哈哈",24,1.82,false,'男');
        System.out.println(s);
    }
}
class student{
    private String name;
    private int age;
    private double height;
    private boolean marriage;
    private char sex;

    public student() {
    }

    public student(String name, int age, double height, boolean marriage, char sex) {
        this.name = name;
        this.age = age;
        this.height = height;
        this.marriage = marriage;
        this.sex = sex;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public double getHeight() {
        return height;
    }

    public void setHeight(double height) {
        this.height = height;
    }

    public boolean isMarriage() {
        return marriage;
    }

    public void setMarriage(boolean marriage) {
        this.marriage = marriage;
    }

    public char getSex() {
        return sex;
    }

    public void setSex(char sex) {
        this.sex = sex;
    }

    @Override
    public String toString() {
        return "student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", height=" + height +
                ", marriage=" + marriage +
                ", sex=" + sex +
                '}';
    }
}